package io.renren.modules.app.service.user.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import io.renren.modules.app.dao.user.UserEducationDao;
import io.renren.modules.app.entity.user.UserEducationEntity;
import io.renren.modules.app.service.user.UserEducationService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;



@Service("UserEducationService")
@RequiredArgsConstructor
public class UserEducationServiceImpl extends ServiceImpl<UserEducationDao, UserEducationEntity> implements UserEducationService {

    private final UserEducationDao userEducationDao;

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<UserEducationEntity> page = this.page(
                new Query<UserEducationEntity>().getPage(params),
                new QueryWrapper<UserEducationEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public UserEducationEntity queryByResumeId(Integer resumeId) {

        return baseMapper.selectOneByresumeId(resumeId);
    }

    @Override
    public List<UserEducationEntity> queryListByUserId(Integer resumeId) {
        return userEducationDao.selectList(new LambdaQueryWrapper<UserEducationEntity>()
                .eq(UserEducationEntity::getResumeId, resumeId));
    }

}